using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
using System.Configuration;

namespace AzureGames.Web
{
    public class WebRole : RoleEntryPoint
    {
        public override bool OnStart()
        {
            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            ////Sets up tracing to that the trace informatino gets written to the Azure WADLogsTable 
            ////according to the scheduledTransfer period
            //var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
            //var scheduledTransferPeriod = int.Parse(ConfigurationManager.AppSettings["ScheduledTransferPeriod"]);
            //config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(scheduledTransferPeriod);
            ////I have set this to verbose so that all captured trace messages get written to tablestorage
            ////to control which level get captured change the switch value in the web.config
            //config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
            DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString");

            return base.OnStart();
        }
    }
}
